home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / COMMON / TOOLS / VB / CABINETS / MSDAO350.CAB / icontrols / RichText / EditStreamProc.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-01-08  |  1.2 KB  |  40 lines

  1. package icontrols.RichText;
  2.  
  3. import com.ms.dll.Callback;
  4. import com.ms.dll.DllLib;
  5. import com.ms.wd.io.IOException;
  6.  
  7. final class EditStreamProc extends Callback {
  8.    private RichText richText;
  9.  
  10.    public EditStreamProc(RichText richText) {
  11.       this.richText = richText;
  12.    }
  13.  
  14.    public int callback(int dwCookie, int buf, int cb, int transferred) {
  15.       int ret = 0;
  16.       int[] trans = new int[1];
  17.       DllLib.copy(transferred, trans, 0, 1);
  18.  
  19.       try {
  20.          switch (dwCookie) {
  21.             case 0:
  22.                trans[0] = this.richText.bis.read(buf, cb);
  23.                if (trans[0] < 0) {
  24.                   trans[0] = 0;
  25.                }
  26.                break;
  27.             case 1:
  28.                this.richText.bos.write(buf, cb);
  29.                trans[0] = cb;
  30.          }
  31.       } catch (IOException var8) {
  32.          trans[0] = 0;
  33.          ret = 1;
  34.       }
  35.  
  36.       DllLib.copy(trans, 0, transferred, 1);
  37.       return ret;
  38.    }
  39. }
  40.